<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\Commodity;
use Illuminate\Http\Request;

class CommodityController extends Controller
{
    /**
     * 分页
     */
    public function entry(){
        return Commodity::where('pa_id','=',Request::capture()->get('cid',1))
            ->paginate(Request::capture()->get('num',5));
    }

    public function detail(){
        return Commodity::find(
            Request::capture()->get('id',1)
        );
    }
}
